package com.lottery.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import com.lottery.dao.MemberDao;
import com.lottery.entity.Result;
import com.lottery.entity.ResultCode;

@Controller
public class ActivateHandler extends BaseController{
	@Autowired
	private MemberDao memberDao;
	private Logger logger = LoggerFactory.getLogger(ActivateHandler.class);
	@RequestMapping(value = "/activate", method = RequestMethod.GET, produces = TEXT_HTML)
	public ModelAndView getAddManagerPage(String id,String code) {
		logger.info("%%%%%%%%%%%%%"+id);
		logger.info("*************"+code);
		Result result = new Result();
		int activate = memberDao.activate(id, code);
		if(activate == 1){
			result.setSuccess(true);
			result.resultCode(ResultCode.SUCCESS);
		}else{
			result.setSuccess(false);
			result.resultCode(ResultCode.FAILD);
		}
		return respMav("activate", result);
	}
}
